import Vue from 'vue'
import Lightbox from './index.vue'

const LightboxBox = Vue.extend(Lightbox)

Lightbox.install = function (options, type) {
  if (typeof options === 'string') {
    options = {
      src: options
    }
  }

  let instance = new LightboxBox({
    data: options
  }).$mount()

  document.body.appendChild(instance.$el)

  Vue.nextTick(() => {
    instance.visible = true
  })
}

export default Lightbox